Skip to content

feat: list available ".env" variable names for non-hosted apps#437

Merged
zimeg merged 16 commits intomainfrom
zimeg-feat-dotenv-list
Mar 30, 2026
Merged

feat: list available ".env" variable names for non-hosted apps#437
zimeg merged 16 commits intomainfrom
zimeg-feat-dotenv-list

Conversation

@zimeg
Copy link
Copy Markdown
Member

@zimeg zimeg commented Mar 25, 2026

Changelog

The slack env list command will now list the environment variables available from the .env file for apps that aren't run on Slack infrastructure.

Summary

This PR lists available .env variable names for non-hosted apps to match what's available to hooks and the run command.

Preview

demo

Reviewers

Your check is so appreciated. The following commands might recommend testing:

$ slack create asdf -t slack-samples/bolt-js-starter-template
$ cd asdf
$ echo "EXAMPLE_TOKEN=12" > .env
$ slack install
$ slack env list
$ slack create asdf -t slack-samples/deno-starter-template
$ cd asdf
$ slack deploy
$ slack env add   # Perhaps odd examples can be used
$ slack env list

When done please do delete these apps! This is the environment command kindplace 🌲 ✨

Requirements

@zimeg zimeg added this to the Next Release milestone Mar 25, 2026
@zimeg zimeg self-assigned this Mar 25, 2026
@zimeg zimeg requested a review from a team as a code owner March 25, 2026 06:32
@zimeg zimeg added enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment labels Mar 25, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.41%. Comparing base (1ddaf8e) to head (c381609).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/env/list.go 86.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #437      +/-   ##
==========================================
- Coverage   70.42%   70.41%   -0.01%     
==========================================
  Files         221      221              
  Lines       18533    18539       +6     
==========================================
+ Hits        13051    13055       +4     
- Misses       4308     4310       +2     
  Partials     1174     1174              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

   *  Thoughts for the fantastic reviewers!  *

Image

Comment on lines +38 to +44
"List environment variables available to the app at runtime.",
"",
"This command is supported for apps deployed to Slack managed infrastructure but",
"other apps can attempt to run the command with the --force flag.",
"Commands that run in the context of a project source environment variables from",
"the \".env\" file. This includes the \"run\" command.",
"",
"The \"deploy\" command gathers environment variables from the \".env\" file as well",
"unless the app is using ROSI features.",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📸 Preview

Image

cmd/env/list.go Outdated
return err
}
} else {
dotEnv, err := hooks.LoadDotEnv(clients.Fs)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪝 note: We reuse the logic that hooks has for gathering environment variables for confidence in matching!

🐟 ramble: We don't require app selection before this at this point, but we might consider keeping it to avoid breaking change if it becomes required later. FWIW it's required for hosted apps so this is familiar experience I think!

Copy link
Copy Markdown
Contributor

@srtaalej srtaalej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working nicely for me! thanks for adding these changes ⭐

}))

if len(variableNames) <= 0 {
if count <= 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch i wonder why count was not used here before 🤔

Base automatically changed from zimeg-feat-load-hook-dotenv to main March 30, 2026 18:53
@zimeg
Copy link
Copy Markdown
Member Author

zimeg commented Mar 30, 2026

@srtaalej Super appreciate the review and testing! 🧪 ✨

I was confused on the guards earlier and perhaps shouldn't have changed it in this PR but IIRC we were considering follow up improvements to these UI soon so I'll merge this! 🧰

@zimeg zimeg merged commit f164165 into main Mar 30, 2026
8 checks passed
@zimeg zimeg deleted the zimeg-feat-dotenv-list branch March 30, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants